<?php 
  require_once("konf.php"); 
  if(isSet($_REQUEST["kustutamise_id"])){
     $kask=$yhendus->prepare("DELETE FROM mikrobussivedu WHERE id=?");
	 $kask->bind_param("s", $_REQUEST["kustutamise_id"]);
	 $kask->execute();
  }
?>
<!doctype html>
<html>
  <head>
    <title>Klientide soovid</title>
  </head>
  <body>
    <h1>Soovid</h1>
    <table>
	  <?php
	     $kask=$yhendus->prepare("SELECT id, kliendinimi, kliendisoov FROM mikrobussivedu");
		 $kask->bind_result($id, $kliendinimi, $kliendisoov);
		 $kask->execute();
		 while($kask->fetch()){
		    $kliendinimi=htmlspecialchars($kliendinimi);
		    echo "<tr>
			  <td>$kliendinimi</td>
			  <td>$kliendisoov</td>
			  <td><a href='?kustutamise_id=$id'>Kustuta</a></td>
			</tr>";
		 }
	  ?>
	</table>
  </body>
</html>
<?php
  $yhendus->close();
?>
